module WatchedPage
  module WatchedPagesController
    # GET /watched_pages
    # GET /watched_pages.xml
    def index
      @watched_pages = WatchedPage.find(:all)
      
      respond_to do |format|
        format.html # index.html.erb
        format.xml  { render :xml => @watched_pages }
      end
    end
    
    # GET /watched_pages/1
    # GET /watched_pages/1.xml
    def show
      @watched_page = WatchedPage.find(params[:id])
      
      respond_to do |format|
        format.html # show.html.erb
        format.xml  { render :xml => @watched_page }
      end
    end
    
    # GET /watched_pages/new
    # GET /watched_pages/new.xml
    def new
      @watched_page = WatchedPage.new
      
      respond_to do |format|
        format.html # new.html.erb
        format.xml  { render :xml => @watched_page }
      end
    end
    
    # GET /watched_pages/1/edit
    def edit
      @watched_page = WatchedPage.find(params[:id])
    end
    
    # POST /watched_pages
    # POST /watched_pages.xml
    def create
      @watched_page = WatchedPage.new(params[:watched_page])
      
      respond_to do |format|
        if @watched_page.save
          flash[:notice] = 'WatchedPage was successfully created.'
          format.html { redirect_to(@watched_page) }
          format.xml  { render :xml => @watched_page, :status => :created, :location => @watched_page }
        else
          format.html { render :action => "new" }
          format.xml  { render :xml => @watched_page.errors, :status => :unprocessable_entity }
        end
      end
    end
    
    # PUT /watched_pages/1
    # PUT /watched_pages/1.xml
    def update
      @watched_page = WatchedPage.find(params[:id])
      
      respond_to do |format|
        if @watched_page.update_attributes(params[:watched_page])
          flash[:notice] = 'WatchedPage was successfully updated.'
          format.html { redirect_to(@watched_page) }
          format.xml  { head :ok }
        else
          format.html { render :action => "edit" }
          format.xml  { render :xml => @watched_page.errors, :status => :unprocessable_entity }
        end
      end
    end
    
    # DELETE /watched_pages/1
    # DELETE /watched_pages/1.xml
    def destroy
      @watched_page = WatchedPage.find(params[:id])
      @watched_page.destroy
      
      respond_to do |format|
        format.html { redirect_to(watched_pages_url) }
        format.xml  { head :ok }
      end
    end
  end
end